package com.aiss.ws.activity;

import android.app.Activity;
import android.content.Context;
import android.widget.EditText;
import android.widget.TextView;

import com.aiss.ws.R;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

/**
 * Created by chenqiang on 16/5/17.
 */
@EActivity(R.layout.activity_login)
public class LoginActivity extends BaseActivity {

    private static Activity act;

    @ViewById(R.id.title)
    TextView title_tv;


    @Click(R.id.back)
    void setBack(){
        finish();
    }


    @AfterViews
    void init(){
        act = this;
        title_tv.setText("注册");
    }

    /**
     * 用户名
     */
    @ViewById(R.id.user)
    EditText user;
    /**
     * 密码
     */
    @ViewById(R.id.password1)
    EditText password1;
    /**
     * 确认密码
     */
    @ViewById(R.id.password2)
    EditText password2;

    /**
     * 补全资料
     */
    @Click(R.id.next_button)
    void next_button(){


        if(password1.getText().toString().equals("")||password2.getText().toString().equals("")||user.getText().toString().equals("")){
            showMessage("用户名密码不能为空");
            return;
        }

        if(!password1.getText().toString().equals(password2.getText().toString())){
            showMessage("两次输入的密码不同");
            return;
        }

        if(password1.getText().toString().length()<6){
            showMessage("密码至少需要6位");
            return;
        }

        if(password2.getText().toString().length()<6){
            showMessage("密码至少需要6位");
            return;
        }



        LoginInforActivity_.intent(this).extra("user",user.getText().toString())
                .extra("password1",password1.getText().toString())
                .extra("password2",password2.getText().toString())
                .start();
    }

    public static Activity getActivity(){
        return act;
    }




}
